<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\api\v1\LoginController;
use App\Http\Controllers\api\v1\UserController;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

//用户授权
Route::post('index',[LoginController::class,'index']);


Route::group(['middleware'=>'auth:api'],function (){
    //发送验证码
    Route::get('send/sms',[LoginController::class,'sendSms']);
    //小程序登录，获取token
    Route::post('wxlogin',[LoginController::class,'wxlogin']);
});

Route::group(['middleware'=>['auth:api','check_api']],function (){

    //身份认证
    Route::post('v1/upfile',[UserController::class,'uploadFile']);


    Route::group(['prefix'=>'v1/user'],function (){
        //添加用户信息
        Route::post('userinfo',[UserController::class,'userinfo']);
        //获取用户信息
        Route::get('userinfo',[UserController::class,'getUserinfo']);
    });



});
